package com.way.demo.test;

import java.util.Arrays;

/**
 * @author lipingwei
 * @create 2023-03-05 15:58
 */
public class SortTest2 {

    public static void main(String[] args) {
        int [] arr={3,5,1,0,7};
        bubbleSort(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void bubbleSort(int [] arr){

        for(int i=0 ; i<arr.length-1;i++){
            for(int j=0; j<arr.length-1-i;i++){

                 if(arr[j]>arr[j+1]){
                     int temp=arr[j];
                     arr[j]=arr[j+1];
                     arr[j+1]=temp;
                 }

            }
        }

    }

}
